package com.yan.controller;

import com.jfinal.core.Controller;
import com.yan.annon.RouterMapping;
import com.yan.bean.User;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by yanl_ on 2018/1/7.
 */
@RouterMapping(url = "/user", viewPath = "/")
public class UserController extends Controller {


    public void index() {
        User u = getBean(User.class, "");
        User user = User.dao.getUserByNameAndPwd(u);
        setAttr("user", user);
        setSessionAttr("usertest", "test");
        render("user.jsp");
    }


    public void index1() {
        User u = new User();
        u.set("userName", "yan");
        u.set("password", "yan");
        User user = User.dao.getUserByNameAndPwd(u);

        renderJson(u);
    }
}
